#ifndef __cmd_H__
#define __cmd_H__

#include "func.h"

#define BUFFSIZE 1024
#define MAXCMDLEN 256

typedef enum CMD{
    CMD_TYPE_OTHERS = -1,
    CMD_TYPE_EXIT,
    CMD_TYPE_CD,
    CMD_TYPE_MV,
    CMD_TYPE_CP,
    CMD_TYPE_LS,
    CMD_TYPE_LL,
    CMD_TYPE_PWD,
    CMD_TYPE_PUTS,
    CMD_TYPE_GETS,
    CMD_TYPE_RM,
    CMD_TYPE_MKDIR
}cmdType;

//统一传参接口
typedef struct{
    int argLen;        //参数实际长度
    char arg[128];     //存放参数数组
}argument_t;

typedef struct{
    cmdType cmd;        //指令
    int argSize;        //参数个数
    argument_t args[2]; //指令后接参数的数组 具体参照上述结构体
}cmd_t;

//火车
typedef struct train{
    int length;
    char buff[BUFFSIZE];
}train_t;

int puts_filename_command(int fd, cmd_t *cmd);
int gets_filename_command(int fd, cmd_t *cmd);
int mkdir_command(int fd, cmd_t *cmd);
int rm_command(int fd, cmd_t *cmd);
int mv_command(int fd, cmd_t *cmd);
int cd_command(int fd, cmd_t *cmd);
int pwd_command(int fd, cmd_t *cmd);
int cp_command(int fd, cmd_t *cmd);
int ll_command(int fd, cmd_t *cmd);
int ls_command(int fd, cmd_t *cmd);
int getsfileplus_command(int peerfd,const char* pthname);
int copy_dir(char* srcpathname,char* dstpathname);
int copy_file(char* srcpathname,char* dstpathname);
int rm_dir(char* dirname);
int rm_file(char* filename);
#include<mysql/mysql.h>
//mysql -c 相关
int DatabaseInit_server(void);
int showTable(char* tablename);
int mysqlRegisterUsername(int peerfd,char*regist_name);
int mysqlRegisterPasswd(int peerfd,const char* registusername);
////////////////////////////////////////////////////////////
//用户注册登录相关
void getrandomsalt(char* salt);    
#endif
